package com.ctshk.sapp.scenic.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.rpc.scenic.dto.AirshowProductDTO;
import com.ctshk.rpc.scenic.req.AirshowApiSettingReq;
import com.ctshk.rpc.scenic.req.AirshowProductListReq;
import com.ctshk.rpc.scenic.req.AirshowProductReq;
import com.ctshk.rpc.scenic.service.IAirshowDistributorSettingService;
import com.ctshk.rpc.scenic.service.IAirshowProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import com.ctshk.common.web.support.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-06-10
 */
@RestController
@RequestMapping("/airshow-product")
@Api(value="航展套票产品服务", tags="航展套票产品服务")
public class AirshowProductController extends BaseController {

    @DubboReference
    private IAirshowProductService iAirshowProductService;

    @ApiOperation(value="添加航展套票产品", notes="添加航展套票产品")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.ADD, operTitle = "添加航展套票产品", operDesc = "添加航展套票产品")
    @PostMapping("/add-product")
    public Result addProduct(@RequestBody AirshowProductReq airshowProductReq){
        return iAirshowProductService.addProduct(airshowProductReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value="编辑航展套票产品", notes="编辑航展套票产品")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.UPDATE, operTitle = "编辑航展套票产品", operDesc = "编辑航展套票产品")
    @PostMapping("/update-product")
    public Result updateProduct(@RequestBody AirshowProductReq airshowProductReq){
        return iAirshowProductService.updateProduct(airshowProductReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "查询产品详情", notes = "查询产品详情")
    @GetMapping(value = "/get-product-by-id")
    public Result getProductById(Long id) {
        return iAirshowProductService.getProductById(id);
    }

    @ApiOperation(value="查询套票产品列表", notes="查询套票产品列表")
    @PostMapping("/get-product-list-by-params")
    public Result getProductListByParams(@RequestBody AirshowProductListReq airshowProductReq){
        return Result.success(iAirshowProductService.getProductListByParams(airshowProductReq));
    }

}
